package cn.liontalk.service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @author ZhouZhe
 * @version 1.0
 * @description 测试Service
 * @date 2018-12-02 16:56
 **/
@Service
public class HelloService {


    @Autowired
    private RestTemplate restTemplate;


    @HystrixCommand(fallbackMethod="testHelloServiceError")
    public String testHelloService(){
        return restTemplate.getForObject("http://eureka-client/hi",String.class);
    }

    public String testHelloServiceError(){
        return "Test Hello Service Error!";
    }

}
